<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>添加菜单</title>
		<link rel="stylesheet" type="text/css" href="css/common.css" />
		<style>
			body {
				background: #Fff;
			}
			
			.form>form>div label {
				width: 77px;
				text-align: right;
				display: inline-block;
			}
			
			.form>form>div label.error {
				width: auto;
			}
		</style>
	</head>

	<body>
		<div class="form" style="padding:20px 40px;">
			<input type="hidden" value="" class="aid" />
			<form class="block-form" id="commentForm">
				<div style="margin-top:0px;">
					<label><span class="red">*</span>选择事件：</label>
					<div class="overlay">
						<!--这个是用来存放选中的select的值的-->
						<input type="hidden" value="" class="form-select-value" name="newEventname" />
						<div class="dropdown">
							<button class="dropdown-toggle form-dropdown" type="button">
				                                <span class="value" data-default="全部" >全部</span>
				                                <span class="caret"></span>
				                            </button>
							<ul class="none">
								<li data-value=''>全部</li>
								<li data-value='1'>红包预警</li>
								<li data-value='2'>库存不足</li>
							</ul>
						</div>
					</div>
				</div>
				<div>
					<label><span class="red hidden">*</span>所属企业：</label>
					<div class="overlay">
						<!--这个是用来存放选中的select的值的-->
						<input type="hidden" value="" class="form-select-value" name="newcompany" />
						<div class="dropdown">
							<button class="dropdown-toggle form-dropdown" type="button">
				                <span class="value" data-default="全部" >全部</span>
				                <span class="caret"></span>
				            </button>
							<ul class="none">
								<li data-value=''>全部</li>
								<li data-value='1'>酒厂</li>
								<li data-value='2'>平台</li>
								<li data-value='2'>制盖厂</li>
							</ul>
						</div>
					</div>
				</div>
				<div>
					<div class="fl">
						<label><span class="red hidden">*</span>策略类型：</label>
						<div class="overlay">
							<!--这个是用来存放选中的select的值的-->
							<input type="hidden" value="" class="form-select-value" name="newcompany" />
							<div class="dropdown">
								<button class="dropdown-toggle form-dropdown" type="button">
					                <span class="value" data-default="全部" >全部</span>
					                <span class="caret"></span>
					            </button>
								<ul class="none">
									<li data-value=''>全部</li>
									<li data-value='1'>酒厂</li>
									<li data-value='2'>平台</li>
									<li data-value='2'>制盖厂</li>
								</ul>
							</div>
						</div>
					</div>
					<div class="fl">
						<label><span class="red hidden">*</span>每：</label>
						<input type="text" value="" class="form-select-value" name="hour" />小时
					</div>
				</div>
				<div class="clearfix"></div>

				<div>
					<label><span class="red ">*</span>预警方式：</label>
					<div style="margin-left: -14px;" class="checkbox inline-block" data-id="1" style="position:relative;z-index:10;"> 
						<input type="checkbox" style="width:auto;" value="1" class="label-input" name="newEventObj"  id="checkbox_layer_1" /> 
						<label for="checkbox_layer_1" class="input-label"></label> 
					</div>系统消息
					<div style="margin-left: -14px;" class="checkbox inline-block" data-id="1" style="position:relative;z-index:10;"> 
						<input type="checkbox" style="width:auto;" value="1" class="label-input" name="newEventObj"  id="checkbox_layer_2" /> 
						<label for="checkbox_layer_2" class="input-label"></label> 
					</div>短信消息
				</div>

				<div>
					<label><span class="red ">*</span>状态：</label>
					<input type="radio" class="radio" name="status" value="1" /> 显示
					<input type="radio" class="radio" name="status" value="2" /> 隐藏
				</div>
				<div>
					<label><span class="red hidden">*</span>备注：</label>
					<textarea style="width:358px;height:121px;vertical-align: top;" class="note" name="note" id="note"></textarea>
				</div>
				<div>
					<label class="hidden"><span class="red hidden">*</span>产品名称：</label>
					<input type="submit" value="保存" class="search-input-button bgblue" id="subButton" style="margin-right:120px;" />
					<input type="button" value="返回" class="search-input-button " id="backButton" />
				</div>
			</form>
		</div>

		<script src="js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>

		<script>
			var index = parent.layer.getFrameIndex(window.name); /*获取窗口索引*/
			$.validator.setDefaults({
				submitHandler: function() {
					//这里放验证成功之后要执行的函数

					//parent.location.reload();
					document.getElementById('commentForm').addEventListener('submit', function(data) {
						parent.location.reload();
					});
				}
			});

			$(document).ready(function() {

				$("#commentForm").validate({
					rules: {
						name: {
							required: true,
						},
						icon: {
							required: true,
						},
					},
					messages: {
						name: {
							required: "<i class=\" icon icon_error_red \"></i>请输入菜单名称",
						},

						icon: {
							required: "<i class=\" icon icon_error_red \"></i>请输入图标名称",
						},
					},
					errorPlacement: function(error, element) {
						error.appendTo('<i class=\" icon icon_error_red \"></i>').appendTo(element.parent());
					},
				});
				$('#backButton').click(function() {
					parent.layer.close(index);
				})
			});
		</script>

	</body>

</html>